import type { PageRes } from '@/types/common'
import type {
  GetDepAllItemRes,
  GetPatientConsultOrderDetailRes,
  GetPatientConsultOrderListParams,
  GetPatientConsultOrderListRes,
  GetPatientConsultOrderPreParams,
  GetPatientConsultOrderPreRes,
  PostPatientConsultOrderParams,
  PostPatientConsultPayParams,
  PostPatientConsultPayRes,
} from '@/types/consult'
import { request } from '@/utils/request'

// 查询所有科室-层级
export const getDepAllAPI = () => request<GetDepAllItemRes[]>('/dep/all')

// 问诊-支付页面-计算就诊信息和抵扣信息
export const getPatientConsultOrderPreAPI = (params: GetPatientConsultOrderPreParams) =>
  request<GetPatientConsultOrderPreRes>('/patient/consult/order/pre', 'GET', params)

// 问诊-保存/修改问诊订单
export const postPatientConsultOrderAPI = (params: PostPatientConsultOrderParams) =>
  request<{ id: string }>('/patient/consult/order', 'POST', params)

// 问诊-支付接口
export const postPatientConsultPayAPI = (params: PostPatientConsultPayParams) =>
  request<PostPatientConsultPayRes>('/patient/consult/pay', 'POST', params)

// 问诊-查询订单详情信息
export const getPatientConsultOrderDetailAPI = (params: { orderId: string }) =>
  request<GetPatientConsultOrderDetailRes>('/patient/consult/order/detail', 'GET', params)

// 问诊记录-订单列表-找医生、极速问诊、开药问诊
export const getPatientConsultOrderListAPI = (params: GetPatientConsultOrderListParams) =>
  request<PageRes<GetPatientConsultOrderListRes>>('/patient/consult/order/list', 'GET', params)
